﻿using Angle.Krill.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Angle.Krill
{
    public partial class ScreenRecorder : DummyWindow
    {
        public ScreenRecorder()
        {
            InitializeComponent();
        }

        private void ScreenRecorder_Load(object sender, EventArgs e)
        {
            this.DoubleBuffered = true;
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            var btn = sender as AntdUI.Button;
            bool bo = bool.Parse((btn)?.Tag?.ToString());
            if (bo)
            {
                btn.Tag = false;
                btn.Text = "停止";

                string filePath = "E:\\test_video.avi";
                ScreenRecorderHelper.Instance.StartScreenRecord(filePath, 25, Screen.PrimaryScreen.WorkingArea);
            }
            else
            {
                btn.Tag = true;
                btn.Text = "开始";

                ScreenRecorderHelper.Instance.StopScreenRecord();
            }
        }
    }
}
